<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<h1>Form</h1>
<form action="#" th:action="@{/login}" th:object="${user}" method="post">
    <label>
        用户名:<input type="text" th:field="*{username}" />
    </label>
    <label>密码:<input type="text" th:field="*{password}" /></label>
    <p><input type="submit" value="Submit" /></p>
</form>
<div th:text="${message}" style="color: red"></div>
</body>
</html>